package com.xishu.entity.shop;

import com.xishu.annotation.dao.DefaultValue;
import com.xishu.annotation.dao.Search;
import com.xishu.annotation.lang.Lang;
import com.xishu.entity.AbstractEntity;
import com.xishu.entity.oplog.OpName;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity(name = "company_main_item")
@Table(indexes = {@Index(columnList = "companyId")})
public class CompanyMainItem extends AbstractEntity implements OpName {
    private static final long serialVersionUID = -7680864917695421121L;

    @Transient
    private String opName;

    @ApiModelProperty(value = "总店餐厅的ID")
    private Long companyId;

    @ApiModelProperty(value = "菜品名")
    @Lang(key = "name")
    private String name;

    @ApiModelProperty(value = "菜品名中文")
    @Lang(key = "name")
    @Search(like = true)
    private String name_zh;

    @ApiModelProperty(value = "菜品名英文")
    @Lang(key = "name")
    @Search(like = true)
    private String name_en;

    @Transient
    @Search(or = true, fieldList = "name_zh,name_en")
    private String name_zh_en;

    @ApiModelProperty(value = "菜品类型，0是普通菜，1是套餐")
    @DefaultValue(defaultValue = "0")
    private Integer itemType;

    public String getName_zh_en() {
        return name_zh_en;
    }

    public void setName_zh_en(String name_zh_en) {
        this.name_zh_en = name_zh_en;
    }

    public Long getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Long companyId) {
        this.companyId = companyId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName_zh() {
        return name_zh;
    }

    public void setName_zh(String name_zh) {
        this.name_zh = name_zh;
    }

    public String getName_en() {
        return name_en;
    }

    public void setName_en(String name_en) {
        this.name_en = name_en;
    }

    public Integer getItemType() {
        return itemType;
    }

    public void setItemType(Integer itemType) {
        this.itemType = itemType;
    }

    @Override
    public void setOpName(String str) {
        this.opName = str;
    }

    @Override
    public String getOpName() {
        return opName;
    }

    @Override
    public String opType() {
        return "主菜";
    }

    @Override
    public String[] fieldName() {
        return new String[]{"name_zh", "name_en"};
    }
}
